1. Field of the Invention
The present invention relates to an image processing apparatus and method of controlling the same.
2. Description of the Related Art
In recent years, computerization has advanced, and a system which scans a paper document using a scanner or the like to convert it into digital data in place of storing the paper document intact, and transmits the digital data to another apparatus has prevailed. On the other hand, in order to save transmission cost of digital data and a storage area of a storage device, it is required to highly compress digital document data.
However, if a document image includes both a character area and photo area, and if compression (for example, lossless compression) suited to the character area is applied to the entire document image, image quality after decoding is high but a low compression ratio is obtained. On the other hand, if compression (for example, lossy compression such as JPEG) suited to the photo area is applied to the entire document image, a high compression ratio is obtained, but character images after decoding deteriorate.
Conventionally, as an image compression method, a coding method for encoding image data by transforming it into data on a frequency space is used. JPEG recommended as an international standard method of still image coding is a typical example of transformation coding using DCT (Discrete Cosine Transform) in transformation onto the frequency space. Processes of JPEG coding processing will be briefly described below.
An image to be encoded is divided into rectangular blocks, and DCT transformation is applied to respective pixel values in each block. Coefficients obtained by this transformation are quantized according to a desired image quality level and code size, and quantized transformation coefficients are entropy-encoded. JPEG Baseline adopts Huffman coding as an entropy coding method of coefficients. Since one block includes 8×8 pixels (=64 pixels), the DCT transformation generates one DC component value and 63 AC component values. The DC component value is encoded as a difference value from an immediately preceding block, and the AC component values are Huffman-encoded by a combination of zero runs and non-zero coefficient values.
Note that in order to increase a compression ratio, a method of sampling a block of 8×8 pixels as follows is available. Luminance components and color difference components are acquired from input image data to generate blocks of 16×16 pixels. As for luminance components (Y), four blocks of 8×8 pixels are used as luminance plane data. As for color difference components (Cb, Cr), 2×2 pixels are combined to obtain one pixel value, thereby generating color difference plane data of one block of 8×8 pixels (FIG. 1A).
The aforementioned processing is that generally called 4:1:1 sub-sampling, and the resolutions of color difference components are ½ of those of luminance components respectively in vertical and horizontal directions. As a result, the compression ratio can be doubled. Likewise, processing called 4:2:2 sub-sampling in which the resolution in only the vertical or horizontal direction is halved is available (FIG. 1B). Furthermore, FIG. 1C shows an example of 4:4:4 sub-sampling.
However, if the aforementioned sub-sampling which lowers the resolution of color difference components is applied, a higher compression ratio can be assured but color difference components deteriorate considerably. Especially, color cloud (false color generated by combining inner and outer pixels of an edge) is generated at an edge portion, resulting in a visually unnatural image.
As for reproducibility of colors at an edge portion, Japanese Patent Laid-Open No. 2000-278709 describes a method of improving color reproducibility at an edge portion by generating a new border portion using color difference components in shape data at a border portion of the shape data which expresses a shape of an object. However, in scan data of a hatching pattern or halftone document, if a hatch or halftone dot is determined as an edge, and the same processing as that for shape data such as characters is applied, an undesirable result is generated. More specifically, a tincture may be changed, or moiré may be generated.